package cn.xiaohuodui.exceptions;

import cn.xiaohuodui.constant.ErrorCodeDefine;
import org.springframework.http.HttpStatus;

/**
 * Created by chenqisheng on 15/3/11.
 */

public class BussException extends Exception {
    private HttpStatus httpStatus;
    private int code;

    public BussException() {
    }

    public BussException(String message) {
        super(message);
        this.httpStatus = HttpStatus.BAD_REQUEST;
        this.code = ErrorCodeDefine.DEFAULT_ERROR.getCode();
    }

    public BussException(int code, String message) {
        super(message);
        this.code = code;
        this.httpStatus = HttpStatus.BAD_REQUEST;
    }

    public BussException(String message, HttpStatus httpStatus) {
        super(message);
        this.httpStatus = httpStatus;
        this.code = ErrorCodeDefine.DEFAULT_ERROR.getCode();
    }

    public BussException(ErrorCodeDefine ErrorCodeDefine) {
        super(ErrorCodeDefine.getDesc());
        this.code = ErrorCodeDefine.getCode();
        this.httpStatus = HttpStatus.BAD_REQUEST;
    }

    public BussException(ErrorCodeDefine ErrorCodeDefine, HttpStatus httpStatus) {
        super(ErrorCodeDefine.getDesc());
        this.code = ErrorCodeDefine.getCode();
        this.httpStatus = httpStatus;
    }

    public HttpStatus getHttpStatus() {
        return httpStatus;
    }

    public void setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
